<template>
    <div>
        <Layout>
            <Header>
                <Menu mode="horizontal" theme="dark">
                    <div v-if="isMo">
                        <span style="color: white">后台</span>
                        <span style="right: 0;position: absolute;" v-if="isMo">
                            <Button @click="doMenu" ghost>
                                <Icon type="ios-menu" color="white"/>
                            </Button>
                        </span>
                    </div>
                    <div v-if="!isMo">
                        <MenuItem name="0" to="/">
                            主页
                        </MenuItem>
                        <Submenu name="1">
                            <template slot="title">
                                <Icon type="ios-paper" />
                                内容管理
                            </template>
                            <MenuItem name="1-2" to="/admin/article">
                                文章管理
                            </MenuItem>
                        </Submenu>
                        <MenuItem name="2" to="/admin/comment">
                            评论管理
                        </MenuItem>
                    </div>
                </Menu>
            </Header>
            <Content>
                <Card v-if="show">
                    <center>
                    <router-link to="/" style="margin-top: 2px">
                        <strong style="font-size: medium; color: dodgerblue">主页</strong>
                    </router-link>
                    <br/>
                    <router-link to="/admin/article" style="margin-top: 2px">
                        <strong style="font-size: medium; color: dodgerblue">文章管理</strong>
                    </router-link>
                    <br/>
                    <router-link to="/admin/comment" style="margin-top: 2px">
                        <strong style="font-size: medium; color: dodgerblue">评论管理</strong>
                    </router-link>
                    </center>
                </Card>
                <router-view></router-view>
            </Content>
            <Footer style="text-align: center">
                纪中三鑫2018届26班29班 保留所有权利 <br/>
                由 26班 <a href="https://www.damanyang.cn" style="text-decoration: none" target="_blank">杨狄男</a> & <a
                    href="https://abalone.life" style="text-decoration: none" target="_blank">陈冠宇</a> 编写/设计
            </Footer>
        </Layout>
    </div>
</template>

<script>
    export default {
        name: "Admin",
        data(){
            return{
                isMo: navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),
                show: false,
            }
        },
        methods:{
            doMenu() {
                if (this.show==true) {
                    this.show = false;
                }
                else {
                    this.show = true;
                }
            },
        }
    }
</script>

<style scoped>

</style>